

import java.awt.event.*;

import javax.swing.*;

@SuppressWarnings("serial")
public class QuitFrame extends JFrame implements ActionListener, WindowListener
{

 
    public QuitFrame() {
        super("Quit Frame");
        JButton button = new JButton("End After This Generation");
        button.addActionListener(this);
        add(button);
        addWindowListener(this);
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        pack();
        setVisible(true);
    }
     
    public void actionPerformed(ActionEvent e) {  
    	dispose();
    }

	@Override
	public void windowActivated(WindowEvent arg0) {	
	}

	@Override
	public void windowClosed(WindowEvent arg0) {
		GeneticVillageSimulator.dontQuit = false;
		System.out.println("Learning Engine Will Quit After this Generation");
	}

	@Override
	public void windowClosing(WindowEvent arg0) {	
	}

	@Override
	public void windowDeactivated(WindowEvent arg0) {	
	}

	@Override
	public void windowDeiconified(WindowEvent arg0) {	
	}

	@Override
	public void windowIconified(WindowEvent arg0) {	
	}

	@Override
	public void windowOpened(WindowEvent arg0) {	
	}


    
  
}
